Rename caller/user attributes to align with OTel conventions#223
Merged
Rename caller/user attributes to align with OTel conventions#223
Conversation
… SDK 1. Rename caller dimension constants to user.* namespace: - CallerIdKey (microsoft.caller.id) -> UserIdKey (user.id) - CallerUpnKey (microsoft.caller.upn) -> UserEmailKey (user.email) - CallerNameKey (microsoft.caller.name) -> UserNameKey (user.name) 2. Rename agent UPN constants to use email: - AgentUPNKey (microsoft.agent.user.upn) -> AgentEmailKey (microsoft.agent.user.email) - CallerAgentUPNKey (microsoft.a365.caller.agent.user.upn) -> CallerAgentEmailKey (microsoft.a365.caller.agent.user.email) 3. Rename data contract properties: - CallerDetails: callerId -> userId, callerUpn -> userEmail, callerName -> userName - AgentDetails: agentUPN -> agentEmail 4. Rename BaggageBuilder methods: - callerId() -> userId(), callerName() -> userName(), callerUpn() -> userEmail(), agentUpn() -> agentEmail() 5. Update all consumers: scopes, BaggageBuilder, processors, TurnContextUtils, ScopeUtils 6. Update all tests to use new naming Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Agent365 Node SDK’s observability attribute schema to align caller identity attributes with OpenTelemetry conventions by moving from legacy microsoft.caller.* keys to standard user.* keys, and by renaming “UPN” terminology to “email” across contracts, constants, baggage builders, hosting utilities, and tests.
Changes:
- Renamed caller attribute constants to
user.id,user.name,user.emailand updated all usages in scopes/processors and hosting utilities. - Renamed agent/caller-agent “UPN” constants and contract fields to “email” equivalents (
agentEmail,GEN_AI_AGENT_EMAIL_KEY,GEN_AI_CALLER_AGENT_EMAIL_KEY). - Updated unit tests and changelog to reflect the breaking API/contract updates.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/observability/extension/hosting/scope-utils.test.ts | Updates hosting scope utility tests to assert new user.* and *email* constants/fields. |
| tests/observability/extension/hosting/output-logging-middleware.test.ts | Validates output span attributes now use OpenTelemetryConstants.USER_* keys. |
| tests/observability/extension/hosting/baggage-middleware.test.ts | Updates baggage assertions from legacy caller keys to user.id. |
| tests/observability/extension/hosting/BaggageBuilderUtils.test.ts | Updates baggage builder utility expectations to new user.* and agent email keys. |
| tests/observability/core/scopes.test.ts | Updates core scope tests to use renamed CallerDetails fields and user.* attribute keys. |
| tests/observability/core/SpanProcessor.test.ts | Updates processor attribute set expectations to include USER_* and new agent/caller-agent email keys. |
| packages/agents-a365-observability/src/tracing/scopes/OpenTelemetryScope.ts | Writes caller identity tags using user.* keys and agent identity using agent email key. |
| packages/agents-a365-observability/src/tracing/scopes/InvokeAgentScope.ts | Writes caller-agent identity email tag via new caller-agent email key. |
| packages/agents-a365-observability/src/tracing/processors/util.ts | Updates the generic/invoke-agent attribute allowlists to the new key names. |
| packages/agents-a365-observability/src/tracing/middleware/BaggageBuilder.ts | Renames fluent setters to userId/userName/userEmail and agentEmail. |
| packages/agents-a365-observability/src/tracing/contracts.ts | Renames AgentDetails.agentUPN → agentEmail and CallerDetails.caller* → user*. |
| packages/agents-a365-observability/src/tracing/constants.ts | Introduces USER_* constants and replaces UPN keys with email equivalents. |
| packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts | Emits caller baggage using user.* keys instead of microsoft.caller.*. |
| packages/agents-a365-observability-hosting/src/utils/ScopeUtils.ts | Updates derived agent/caller details to return agentEmail and user* fields. |
| CHANGELOG.md | Documents the breaking changes and renamed APIs/constants for both packages. |
packages/agents-a365-observability-hosting/src/utils/ScopeUtils.ts
Outdated
Show resolved
Hide resolved
- Remove unused `callerUserId` property from `CallerDetails` (not used in source, tests, or dotnet SDK) - Fix `deriveCallerDetails` JSDoc that incorrectly mentioned "client ip" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nikhilNava
approved these changes
Mar 24, 2026
juliomenendez
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
microsoft.caller.*to OTel standarduser.*namespace (user.id,user.name,user.email)emailterminology (microsoft.agent.user.email,microsoft.a365.caller.agent.user.email)CallerDetails(callerId→userId,callerUpn→userEmail,callerName→userName),AgentDetails(agentUPN→agentEmail)BaggageBuildermethods:callerId()→userId(),callerName()→userName(),callerUpn()→userEmail(),agentUpn()→agentEmail()agents-a365-observabilityandagents-a365-observability-hostingAligns with .NET SDK changes in microsoft/Agent365-dotnet#219
Test plan
pnpm buildpasses (all 11 packages, CJS + ESM)pnpm testpasses (57 suites, 1078 tests)🤖 Generated with Claude Code